package com.example.leetcode.niuke;

import java.util.Scanner;

public class NiuKe10 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = Integer.parseInt(scanner.nextLine());
        String s = scanner.nextLine();
        String[] split = s.split(",");
        for (int i = 0; i<=split.length -k;i++) {
            int t = Integer.MAX_VALUE;
            int count = 0;
            while (count < k) {
                t = Math.min(t,Integer.parseInt(split[count + i]));
                count++;
            }
            System.out.print(t);
            if (i != split.length -k) {
                System.out.print(",");
            }
        }
    }
}
